<?php
class ClsNaanalView
{
    private $module=null;
    private $arrVar=array();
    public function __construct() 
    {
        $class=get_class($this);
        $umodule=substr($class, 4);
        $this->module=strtolower($umodule);
    }
    
    public function addVar($var, $data)
    {
        $this->arrVar[$var]=$data;
    }

    public function __get($name)
    {
        return $this->arrVar[$name];
    }
    
    public function render()
    {
        $arrVar=array();
        foreach($this->arrVar as $var=>$data)
        {
            $arrVar[$var]=$this->$var($data);
        }
        return $arrVar;
    }
    
    public function &getInstance($module)
    {
        if(!isset($arrView[$module]))
        {
            if(file_exists("modules/{$module}/ClsU".ucfirst($module).".php"))
            {
                include_once "modules/{$module}/ClsU".ucfirst($module).".php";
            }
            else if(file_exists(NAANAL_PATH."modules/{$module}/ClsU".ucfirst($module).".php"))
            {
                include_once NAANAL_PATH."modules/{$module}/ClsU".ucfirst($module).".php";
            }
            if(class_exists("ClsU".ucfirst($module)))
            {
                $class="ClsU".ucfirst($module);
                $obj = new $class();
            }
        }
        if(isset($obj))
        {
            return $obj;
        }
        else
            return false;
    }
}
?>